datablock AudioProfile(bloodBurstSound1)
{
   filename    = "./sounds/headshot_tp_01.wav";
   description = AudioDefault3d;
   preload = true;
};
datablock AudioProfile(bloodBurstSound2)
{
   filename    = "./sounds/headshot_tp_02.wav";
   description = AudioDefault3d;
   preload = true;
};
datablock AudioProfile(bloodBurstSound3)
{
   filename    = "./sounds/headshot_tp_03.wav";
   description = AudioDefault3d;
   preload = true;
};
datablock AudioProfile(bloodBurstSound4)
{
   filename    = "./sounds/headshot_tp_04.wav";
   description = AudioDefault3d;
   preload = true;
};

datablock AudioProfile(bloodHitSound1)
{
   filename    = "./sounds/3p_bulletbodyimpact_03.wav";
   description = AudioDefault3d;
   preload = true;
};
datablock AudioProfile(bloodHitSound2)
{
   filename    = "./sounds/3p_bulletbodyimpact_04.wav";
   description = AudioDefault3d;
   preload = true;
};
datablock AudioProfile(bloodHitSound3)
{
   filename    = "./sounds/3p_bulletbodyimpact_05.wav";
   description = AudioDefault3d;
   preload = true;
};
datablock AudioProfile(bloodHitSound4)
{
   filename    = "./sounds/3p_bulletbodyimpact_06.wav";
   description = AudioDefault3d;
   preload = true;
};

datablock AudioProfile(rbloodDripSound1)
{
   filename    = "./sounds/rain_drip1.wav";
   description = audioClose3d;
   preload = true;
};
datablock AudioProfile(rbloodDripSound2)
{
   filename    = "./sounds/rain_drip2.wav";
   description = audioClose3d;
   preload = true;
};
datablock AudioProfile(rbloodDripSound3)
{
   filename    = "./sounds/rain_drip3.wav";
   description = audioClose3d;
   preload = true;
};
datablock AudioProfile(rbloodDripSound4)
{
   filename    = "./sounds/rain_drip4.wav";
   description = audioClose3d;
   preload = true;
};

$RBlood::HeavyHit0 = bloodBurstSound1;
$RBlood::HeavyHit1 = bloodBurstSound2;
$RBlood::HeavyHit2 = bloodBurstSound3;
$RBlood::HeavyHit3 = bloodBurstSound4;
$RBlood::smallHit0 = bloodHitSound1;
$RBlood::smallHit1 = bloodHitSound2;
$RBlood::smallHit2 = bloodHitSound3;
$RBlood::smallHit3 = bloodHitSound4;
$RBlood::smallDrop0 = rbloodDripSound1;
$RBlood::smallDrop1 = rbloodDripSound2;
$RBlood::smallDrop2 = rbloodDripSound3;
$RBlood::smallDrop3 = rbloodDripSound4;

// Ribcage Image
datablock ShapeBaseImageData(RBloodRibcageImage)
{
	shapeFile = "./ribcage.dts";
	emap = true;
	mountPoint = 2;
	offset = "0 0 -0.6";
	eyeOffset = "0 0 0.4";
	rotation = eulerToMatrix("0 0 0");
	scale = "1 1 1";
	doColorShift = true;
	colorShiftColor = "0.500 0.000 0.000 1.000";
	
	stateName[0] = "Ready";
	stateName[1] = "FireA";
	stateName[2] = "Done";
	
	stateTimeoutValue[0] = 0.01;
	stateTimeoutValue[1] = 20;
	stateTimeoutValue[2] = 0;
	
	stateTransitionOnTimeout[0] = "FireA";
	stateTransitionOnTimeout[1]	= "Done";
	
	stateEmitter[1]      = largeRBloodEmitter;
	stateEmitterTime[1]  = 20;
};


// Head stub image
datablock ShapeBaseImageData(RBloodHeadStumpImage)
{
	shapeFile = "./stump_head.dts";
	emap = true;
	mountPoint = 2;
	offset = "0 0 0.025";
	eyeOffset = "0 0 0";
	rotation = eulerToMatrix("0 0 0");
	scale = "1 1 1";
	doColorShift = true;
	colorShiftColor = "0.500 0.000 0.000 1.000";
	
	stateName[0] = "Ready";
	stateName[1] = "FireA";
	stateName[2] = "Done";
	
	stateTimeoutValue[0] = 0.01;
	stateTimeoutValue[1] = 20;
	stateTimeoutValue[2] = 0;
	
	stateTransitionOnTimeout[0] = "FireA";
	stateTransitionOnTimeout[1]	= "Done";
	
	stateEmitter[1]      = largeRBloodEmitter;
	stateEmitterTime[1]  = 20;
	stateEmitterNode[1]				= "muzzleNode";
};
$RBlood_Stump0 = RBloodHeadStumpImage;
datablock ShapeBaseImageData(RBloodChestStumpImage)
{
	shapeFile = "./stump_chest.dts";
	emap = true;
	mountPoint = 2;
	offset = "0 0 0.025";
	eyeOffset = "0 0 0";
	rotation = eulerToMatrix("0 0 0");
	scale = "1 1 1";
	doColorShift = true;
	colorShiftColor = "0.500 0.000 0.000 1.000";
	
	stateName[0] = "Ready";
	stateName[1] = "FireA";
	stateName[2] = "Done";
	
	stateTimeoutValue[0] = 0.01;
	stateTimeoutValue[1] = 20;
	stateTimeoutValue[2] = 0;
	
	stateTransitionOnTimeout[0] = "FireA";
	stateTransitionOnTimeout[1]	= "Done";
	
	stateEmitter[1]      = largeRBloodEmitter;
	stateEmitterTime[1]  = 20;
	stateEmitterNode[1]				= "muzzleNode";
};
$RBlood_Stump1 = RBloodChestStumpImage;
datablock ShapeBaseImageData(RBloodRArmStumpImage)
{
	shapeFile = "./stump_rarm.dts";
	emap = true;
	mountPoint = 2;
	offset = "0 0 0.025";
	eyeOffset = "0 0 0";
	rotation = eulerToMatrix("0 0 0");
	scale = "1 1 1";
	doColorShift = true;
	colorShiftColor = "0.500 0.000 0.000 1.000";
	
	stateName[0] = "Ready";
	stateName[1] = "FireA";
	stateName[2] = "Done";
	
	stateTimeoutValue[0] = 0.01;
	stateTimeoutValue[1] = 20;
	stateTimeoutValue[2] = 0;
	
	stateTransitionOnTimeout[0] = "FireA";
	stateTransitionOnTimeout[1]	= "Done";
	
	stateEmitter[1]      = largeRBloodEmitter;
	stateEmitterTime[1]  = 20;
	stateEmitterNode[1]				= "muzzleNode";
};
$RBlood_Stump2 = RBloodRArmStumpImage;
datablock ShapeBaseImageData(RBloodlarmStumpImage)
{
	shapeFile = "./stump_larm.dts";
	emap = true;
	mountPoint = 2;
	offset = "0 0 0.025";
	eyeOffset = "0 0 0";
	rotation = eulerToMatrix("0 0 0");
	scale = "1 1 1";
	doColorShift = true;
	colorShiftColor = "0.500 0.000 0.000 1.000";
	
	stateName[0] = "Ready";
	stateName[1] = "FireA";
	stateName[2] = "Done";
	
	stateTimeoutValue[0] = 0.01;
	stateTimeoutValue[1] = 20;
	stateTimeoutValue[2] = 0;
	
	stateTransitionOnTimeout[0] = "FireA";
	stateTransitionOnTimeout[1]	= "Done";
	
	stateEmitter[1]      = largeRBloodEmitter;
	stateEmitterTime[1]  = 20;
	stateEmitterNode[1]				= "muzzleNode";
};
$RBlood_Stump3 = RBloodlarmStumpImage;
datablock ShapeBaseImageData(RBloodllegStumpImage)
{
	shapeFile = "./stump_lleg.dts";
	emap = true;
	mountPoint = 2;
	offset = "0 0 0.025";
	eyeOffset = "0 0 0";
	rotation = eulerToMatrix("0 0 0");
	scale = "1 1 1";
	doColorShift = true;
	colorShiftColor = "0.500 0.000 0.000 1.000";
	
	stateName[0] = "Ready";
	stateName[1] = "FireA";
	stateName[2] = "Done";
	
	stateTimeoutValue[0] = 0.01;
	stateTimeoutValue[1] = 20;
	stateTimeoutValue[2] = 0;
	
	stateTransitionOnTimeout[0] = "FireA";
	stateTransitionOnTimeout[1]	= "Done";
	
	stateEmitter[1]      = largeRBloodEmitter;
	stateEmitterTime[1]  = 20;
	stateEmitterNode[1]				= "muzzleNode";
};
$RBlood_Stump5 = RBloodllegStumpImage;
datablock ShapeBaseImageData(RBloodrlegStumpImage)
{
	shapeFile = "./stump_rleg.dts";
	emap = true;
	mountPoint = 2;
	offset = "0 0 0.025";
	eyeOffset = "0 0 0";
	rotation = eulerToMatrix("0 0 0");
	scale = "1 1 1";
	doColorShift = true;
	colorShiftColor = "0.500 0.000 0.000 1.000";
	
	stateName[0] = "Ready";
	stateName[1] = "FireA";
	stateName[2] = "Done";
	
	stateTimeoutValue[0] = 0.01;
	stateTimeoutValue[1] = 20;
	stateTimeoutValue[2] = 0;
	
	stateTransitionOnTimeout[0] = "FireA";
	stateTransitionOnTimeout[1]	= "Done";
	
	stateEmitter[1]      = largeRBloodEmitter;
	stateEmitterTime[1]  = 20;
	stateEmitterNode[1]				= "muzzleNode";
};
$RBlood_Stump4 = RBloodrlegStumpImage;

// Debris
datablock DebrisData(rBloodFootDebris)
{
   emitters = smallBloodEmitter;
   
	shapeFile = "./shoe.dts";
	lifetime = 5.0;
	minSpinSpeed = -500.0;
	maxSpinSpeed = 500.0;
	elasticity = 0.2;
	friction = 0.8;
	numBounces = 2;
	staticOnMaxBounce = true;
	snapOnMaxBounce = false;
	fade = true;

	gravModifier = 1;
};
datablock DebrisData(rBloodHeadDebris)
{
   emitters = largeRBloodEmitter;
   
	shapeFile = "./head.dts";
	lifetime = 5.0;
	minSpinSpeed = -500.0;
	maxSpinSpeed = 500.0;
	elasticity = 0.2;
	friction = 0.8;
	numBounces = 2;
	staticOnMaxBounce = true;
	snapOnMaxBounce = false;
	fade = true;

	gravModifier = 1;
};
datablock DebrisData(rBloodHandDebris)
{
   emitters = smallBloodEmitter;
   
	shapeFile = "./hand.dts";
	lifetime = 5.0;
	minSpinSpeed = -500.0;
	maxSpinSpeed = 500.0;
	elasticity = 0.2;
	friction = 0.8;
	numBounces = 2;
	staticOnMaxBounce = true;
	snapOnMaxBounce = false;
	fade = true;

	gravModifier = 1;
};
datablock DebrisData(bloodBurstDebris)
{
   emitters = smallBloodEmitter;

	shapeFile = "./cube.dts";
	lifetime = 5.0;
	minSpinSpeed = -5000.0;
	maxSpinSpeed = 5000.0;
	elasticity = 0.2;
	friction = 0.8;
	numBounces = 2;
	staticOnMaxBounce = true;
	snapOnMaxBounce = false;
	fade = true;

	gravModifier = 2;
};
datablock DebrisData(bloodChunkDebris)
{
   emitters = smallBloodEmitter;

	shapeFile = "./chunk.dts";
	lifetime = 5.0;
	minSpinSpeed = -2000.0;
	maxSpinSpeed = 2000.0;
	elasticity = 0.2;
	friction = 0.8;
	numBounces = 2;
	staticOnMaxBounce = true;
	snapOnMaxBounce = false;
	fade = true;

	gravModifier = 2;
};

// Explosions
datablock ExplosionData(bloodBurstFinalExplosion)
{
   //explosionShape = "";
   lifeTimeMS = 1000;

   soundProfile = "";
   
   emitter[0] = bloodBurstSprinkleSmallEmitter;
   emitter[1] = "";

   particleEmitter = bloodBurstSmallEmitter;
   particleDensity = 5;
   particleRadius = 0.2;

   debris = bloodBurstDebris;
   debrisNum = 5;
   debrisNumVariance = 0;
   debrisPhiMin = 0;
   debrisPhiMax = 360;
   debrisThetaMin = 0;
   debrisThetaMax = 180;
   debrisVelocity = 5;
   debrisVelocityVariance = 3;

   faceViewer     = true;
   explosionScale = "1 1 1";

   shakeCamera = false;
   camShakeFreq = "7.0 8.0 7.0";
   camShakeAmp = "10.0 10.0 10.0";
   camShakeDuration = 0.75;
   camShakeRadius = 15.0;

   // Dynamic light
   lightStartRadius = 0;
   lightEndRadius = 0;
   lightStartColor = "0.45 0.3 0.1";
   lightEndColor = "0 0 0";

   //impulse
   impulseRadius = 0;
   impulseForce = 0;
   impulseVertical = 0;

   //radius damage
   radiusDamage        = 0;
   damageRadius        = 0;

   //burn the players?
   playerBurnTime = 0;
};
datablock ExplosionData(bloodBurstNoDebrisExplosion : bloodBurstFinalExplosion)
{
   debris = "";
};
datablock ExplosionData(bloodDismemberExplosion : bloodBurstFinalExplosion)
{   
   emitter[0] = bloodBurstSprinkleSmallEmitter;
   emitter[1] = "";

   particleEmitter = bloodBurstLargeEmitter;
   particleDensity = 20;
   particleRadius = 1.0;

   debris = bloodChunkDebris;
   debrisNum = 6;
   debrisNumVariance = 0;
   debrisPhiMin = 0;
   debrisPhiMax = 360;
   debrisThetaMin = 0;
   debrisThetaMax = 180;
   debrisVelocity = 10;
   debrisVelocityVariance = 3;
};
datablock ExplosionData(bloodFootDebrisExplosion : bloodBurstFinalExplosion)
{   
   emitter[0] = "";
   emitter[1] = "";

   particleEmitter = "";
   particleDensity = 20;
   particleRadius = 1.0;

   debris = rBloodFootDebris;
   debrisNum = 2;
   debrisNumVariance = 0;
   debrisPhiMin = 0;
   debrisPhiMax = 360;
   debrisThetaMin = 0;
   debrisThetaMax = 180;
   debrisVelocity = 10;
   debrisVelocityVariance = 5;
};
datablock ExplosionData(bloodHeadDebrisExplosion : bloodBurstFinalExplosion)
{   
   emitter[0] = "";
   emitter[1] = "";

   particleEmitter = "";
   particleDensity = 20;
   particleRadius = 1.0;

   debris = rBloodHeadDebris;
   debrisNum = 1;
   debrisNumVariance = 0;
   debrisPhiMin = 0;
   debrisPhiMax = 360;
   debrisThetaMin = 0;
   debrisThetaMax = 180;
   debrisVelocity = 10;
   debrisVelocityVariance = 5;
};
datablock ExplosionData(bloodHandDebrisExplosion : bloodBurstFinalExplosion)
{   
   emitter[0] = "";
   emitter[1] = "";

   particleEmitter = "";
   particleDensity = 20;
   particleRadius = 1.0;

   debris = rBloodHandDebris;
   debrisNum = 2;
   debrisNumVariance = 0;
   debrisPhiMin = 0;
   debrisPhiMax = 360;
   debrisThetaMin = 0;
   debrisThetaMax = 180;
   debrisVelocity = 10;
   debrisVelocityVariance = 5;
};

// Projectiles
datablock ProjectileData(bloodBurstFinalExplosionProjectile)
{
   directDamage        = 0;
   radiusDamage        = 0;
   damageRadius        = 0;
   explosion           = bloodBurstFinalExplosion;

   directDamageType  = $DamageType::jeepExplosion;
   radiusDamageType  = $DamageType::jeepExplosion;

   explodeOnDeath		= 1;

   armingDelay         = 0;
   lifetime            = 10;
};
datablock ProjectileData(bloodDismemberProjectile : bloodBurstFinalExplosionProjectile)
{
   explosion           = bloodDismemberExplosion;
};
datablock ProjectileData(footGibProjectile : bloodBurstFinalExplosionProjectile)
{
   explosion           = bloodFootDebrisExplosion;
};
datablock ProjectileData(headGibProjectile : bloodBurstFinalExplosionProjectile)
{
   explosion           = bloodHeadDebrisExplosion;
};
datablock ProjectileData(handGibProjectile : bloodBurstFinalExplosionProjectile)
{
   explosion           = bloodHandDebrisExplosion;
};

$RBloodGib0 = footGibProjectile;
$RBloodGib1 = headGibProjectile;
$RBloodGib2 = handGibProjectile;

datablock ProjectileData(rbloodDripProjectile)
{
   directDamage        = 0;
   radiusDamage        = 0;
   damageRadius        = 0;
   explosion           = bloodBurstNoDebrisExplosion;

   particleEmitter     = smallBloodEmitter; //bulletTrailEmitter;

   projectileShapeName = "./cube.dts";
   directDamageType  = $DamageType::jeepExplosion;
   radiusDamageType  = $DamageType::jeepExplosion;

   explodeOnDeath		= 0;

   isBallistic         = true;
   gravityMod 			= 1.0;
   
   armingDelay         = 0;
   lifetime            = 2000;
};

function rbloodDripProjectile::onCollision(%this, %obj, %col, %vec, %speed)
{
	%pos = %obj.getPosition();
	if(%col.getClassName() $= "fxDTSBrick")
	{
		// don't want to always be playing drip sounds because it gets overwhelming very fast
		%rareness = 6;
		%chance = mCeil(%rareness - %obj.fadeAlpha * %rareness);
		if(!getRandom(0, %chance))
		
		serverPlay3D($RBlood::smallDrop[getRandom(0, 3)], %pos);
		
		doBloodSplatter("0 0 -100", setWord(%pos, 2, getWord(%pos, 2) + 0.25), 0);
	}
	else if(%col.getClassName() $= "AIPlayer" || %col.getClassName() $= "Player")
	{
		%col.reddenLimb(getRandom(0, getRandom(0, 3)), 1, 5);
	}
	
	Parent::onCollision(%this, %obj, %col, %vec, %speed);
}